package com.von.controller;

import com.von.param.PdfParam;
import com.von.result.R;
import com.von.service.FileDealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiaosai
 * @version 1.0
 * @date 2021/9/13 14:16:04
 * @describe 文件处理控制台
 * @className
 */
@RestController
@RequestMapping("/file")
public class FileDealController {

    /**
     * @apiDefine file 文件处理
     */

    @Autowired
    private FileDealService fileDealService;

    /**
     * @api {post} /file/pdf base64转pdf
     * @apiGroup user
     * @apiParam {String} filePath 文件路径[必填]
     * @apiParam {String} content base64内容[必填]
     * @apiParamExample {json} Request-Example:
     * {
     *     "filePath":"dataDemo",
     *     "content":"detaDemo"
     * }
     * @apiSuccessExample {json} Success-Response:
     * {
     *     "code":0，
     *     “msg”:"执行成功"，
     *     “data”:null
     * }
     */
    @PostMapping("/pdf")
    public R generatePdf(@RequestBody PdfParam pdfParam){
        fileDealService.generatePdf(pdfParam);
        return R.ok(null);
    }
}
